package flatlandRPG;
import org.lwjgl.util.vector.Vector2f;


// -------------------------------------------------------------------------
/**
 *  A 2D Rectangle.
 *
 *  @author evant
 *  @version Apr 15, 2011
 */
public class GLRectangle extends GLPolygon
{
    private float width;
    private float height;

    // ----------------------------------------------------------
    /**
     * Create a new GLRectangle object with the given width and height.
     * @param width the width of the rectangle
     * @param height the height of the rectangle
     */
    public GLRectangle(float width, float height) {
        super(
            new Vector2f(-(width / 2.0f), -(height / 2.0f)),
            new Vector2f(-(width / 2.0f), (height / 2.0f)),
            new Vector2f((width / 2.0f), (height / 2.0f)),
            new Vector2f((width / 2.0f), -(height / 2.0f)));
        this.width = width;
        this.height = height;
    }

    // ----------------------------------------------------------
    /**
     * Returns the width of the rectangle.
     * @return the width of the rectangle
     */
    public float getWidth()
    {
        return width;
    }

    // ----------------------------------------------------------
    /**
     * Returns the height of the rectangle.
     * @return the height of the rectangle
     */
    public float getHeight()
    {
        return height;
    }
}
